home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / grafik / bildanzeiger / seepix / source.lha / SPFont.c < prev    next >
Text File  |  1992-11-27  |  12KB  |  246 lines

  1. /**SPFont.c**************************************************************
  2.  *                                    *
  3.  *   SeePix -- by Hank Schafer                        *
  4.  *                                    *
  5.  *   SeePix is an IFF Picture Viewer.  It works with Lo-Res,        *
  6.  *   Med-Res, Hi-Res, HAM, and EHB formats.  I'm working on support     *
  7.  *   for X-Specs, and Anim5 formats.                    *
  8.  *                                    *
  9.  *   SeePix is based on a program by Olaf Barthel, called        *
  10.  *   'LoadImage'.  As released, LoadImage had a couple of bugs.     *
  11.  *   The Amiga-Key alternatives to menu use didn't all work.  That's    *
  12.  *   been fixed.  There were two separate print functions in LoadImage    *
  13.  *   which behaved exactly the same.  The redundancy was eliminated.    *
  14.  *   LoadImage used the Topaz ROMFONT, and made no allowances for a    *
  15.  *   different system default font (under 2.04).  I added a built-in    *
  16.  *   font.  I've reworked the code considerably from the original       *
  17.  *   release, to allow for optimizations based on time and space.    *
  18.  *                                    *
  19.  *   SeePix features a palette tool which allows "tweaking" of colors    *
  20.  *   prior to printing, allowing you to modify the color printout to    *
  21.  *   more closely resemble the original graphics (Blue is Blue, not    *
  22.  *   Purple).  SeePix can be Iconified.  SeePix features an ARP     *
  23.  *   interface.  SeePix now uses the PathMaster File Selector.        *
  24.  *                                    *
  25.  ************************************************************************
  26.  *                                                                      *
  27.  *   SeePix Copyright © 1992 by Hank Schafer; all rights reserved.      *
  28.  *                                                                      *
  29.  *   This program is free software; you can redistribute it and/or      *
  30.  *   modify it under the terms of the GNU General Public License as     *
  31.  *   published by the Free Software Foundation, either version 1, or    *
  32.  *   (at your option) any later version.                                *
  33.  *                                                                      *
  34.  *   This program is distributed in the hope that it will be useful,    *
  35.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of     *
  36.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  *
  37.  *   General Public License for more details.                           *
  38.  *                                                                      *
  39.  *   You should have received a copy of the GNU General Public License  *
  40.  *   along with this program; if not, write to:                         *
  41.  *                 Free Software Foundation, Inc.                       *
  42.  *                 675 Massachusetts Ave.                               *
  43.  *                 Cambridge  MA  02139, USA                            *
  44.  *                                                                      *
  45.  **************** Special Function Copyright Notices ********************
  46.  *                                    *
  47.  ****LoadImage Copyright Notice:                    *
  48.  *                                    *
  49.  *   LoadImage is © Copyright 1988, 1989, 1990 by MXM, all rights    *
  50.  *   reserved, written by Olaf Barthel.  No guarantees of any kind are    *
  51.  *   made that this program is 100% reliable.  Use this program on    *
  52.  *   your own risk!                            *
  53.  *                                    *
  54.  ****Iconify Copyright Notice:                        *
  55.  *                                    *
  56.  *   Copyright 1987 by Leo L. Schwab.                    *
  57.  *   Permission is hereby granted for use in any and all programs,    *
  58.  *   both Public Domain and commercial in nature, provided this     *
  59.  *   Copyright notice is left intact.                    *
  60.  *                                    *
  61.  ****ColorWindow (Palette) Copyright Notice:                *
  62.  *                                    *
  63.  * ColorWindow Routine    --  Color Window Routines            *
  64.  *     from Book 1 of the Amiga Programmers' Suite by RJ Mical          *
  65.  *                                    *
  66.  * Copyright (C) 1986, 1987, Robert J. Mical                *
  67.  * All Rights Reserved.                         *
  68.  *                                    *
  69.  ****PathMaster Copyright Notice:                    *
  70.  *                                    *
  71.  * -------------------------------------------------------------------- *
  72.  *   Copyright © 1989 Justin V. McCormick.  All Rights Reserved.    *
  73.  * -------------------------------------------------------------------- *
  74.  *                                    *
  75.  *    The PathMaster name is a trademark of Justin V. McCormick.    *
  76.  *                                    *
  77.  *   PathMaster File Selector source and documentation written by:    *
  78.  *                                    *
  79.  *             Justin V. McCormick.                *
  80.  *           Copyright © 1989 by Justin V. McCormick.         *
  81.  *             All Rights Reserved.                *
  82.  *                                    *
  83.  * -------------------------------------------------------------------- *
  84.  ************************************************************************
  85.  *                                    *
  86.  *   Hope this is something you can use and enjoy.            *
  87.  *                                    *
  88.  ************************************************************************/
  89.  
  90. /*
  91.  * SeePix' internal font...  the code was generated by Gregg Tavares'
  92.  * "ExtractFont" program.  Thanx, Gregg.
  93.  */
  94.  
  95. /*
  96.  * The font is based on the PD venus.font.  This font has fewer characters
  97.  * than the original SPFont, and results in an executable that is 524 bytes
  98.  * smaller than with the original font.
  99.  */
  100.  
  101. /*
  102.  * This font contains special characters at $85 \205 (a special underscore
  103.  * character) and at $7F \177 (the TradeMark symbol).  Also important to any
  104.  * font used for SeePix is the Copyright circled-C at $A9 \251 and the
  105.  * underscored 'o' at $BA \272.
  106.  */
  107.  
  108. static char     fontname[] = "seepix.font";
  109.  
  110. static UWORD    CharData[] =
  111. {
  112.     0x0018, 0x6600, 0x1000, 0x3818, 0x1c70, 0x0000, 0x0000, 0x0003,
  113.     0x7c18, 0x7cfe, 0x02fe, 0x0cfe, 0x7c7c, 0x0000, 0x0c00, 0x60fc,
  114.     0x7c10, 0xf87e, 0xfefe, 0xfe7c, 0xc63c, 0x06c6, 0xc082, 0x867c,
  115.     0xfe7c, 0xfe7e, 0xfcc6, 0xc6c6, 0xc6c6, 0x7e7c, 0xc07c, 0x1000,
  116.     0x3000, 0xc000, 0x0600, 0x3c00, 0xc030, 0x18c0, 0x3800, 0x0000,
  117.     0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x001c, 0x1878, 0x76e0,
  118.     0x3cc3, 0xc3e1, 0x3800,
  119.     0x0018, 0x666c, 0x7cc6, 0x6c18, 0x3018, 0xd618, 0x0000, 0x0006,
  120.     0xc638, 0x060c, 0x06c0, 0x1806, 0xc6c6, 0x0000, 0x1800, 0x3006,
  121.     0xc638, 0xccc0, 0xc6c0, 0xc0c0, 0xc618, 0x06c6, 0xc0c6, 0xc6c6,
  122.     0xc6c6, 0xc6c0, 0x30c6, 0xc6c6, 0x6cc6, 0x0660, 0x600c, 0x3800,
  123.     0x3000, 0xc000, 0x0600, 0x6000, 0xc000, 0x00c0, 0x1800, 0x0000,
  124.     0x0000, 0x0000, 0x3000, 0x0000, 0x0000, 0x0030, 0x180c, 0xdc5b,
  125.     0x66c6, 0xc633, 0x6c00,
  126.     0x0018, 0x44fe, 0xd0cc, 0x3810, 0x600c, 0x3818, 0x0000, 0x000c,
  127.     0xce18, 0x0618, 0x26fc, 0x300c, 0xc6c6, 0x3030, 0x3000, 0x183c,
  128.     0xce6c, 0xc8c0, 0xc6c0, 0xc0c0, 0xc618, 0x06cc, 0xc0ee, 0xe6c6,
  129.     0xc6c6, 0xc67c, 0x30c6, 0xc6d6, 0x38c6, 0x0c60, 0x300c, 0x6c00,
  130.     0x107c, 0xdc7e, 0x767c, 0x607e, 0xdc30, 0x18cc, 0x18c6, 0xfc7c,
  131.     0xfc7e, 0x7e7e, 0xfcc6, 0xc6c6, 0xc6c6, 0xfe30, 0x180c, 0x0055,
  132.     0xdbcc, 0xcc66, 0x6c00,
  133.     0x0018, 0x886c, 0x7c18, 0x7020, 0x600c, 0xfe7e, 0x0000, 0x0018,
  134.     0xd618, 0x3c3c, 0x6606, 0x7c7e, 0x7c7c, 0x3030, 0x607e, 0x0c30,
  135.     0xcec6, 0xdcc0, 0xc6ce, 0xcece, 0xc618, 0x06f8, 0xc0fe, 0xf6d6,
  136.     0xccc6, 0xcc06, 0x30c6, 0xc6fe, 0x387c, 0x7e60, 0x180c, 0xc600,
  137.     0x0806, 0xc6c0, 0xc6c6, 0x6cc6, 0xc630, 0x18f8, 0x18fe, 0xc6c6,
  138.     0xc6c6, 0x60c0, 0x30c6, 0xc6c6, 0x6cc6, 0x0ce0, 0x1806, 0x0011,
  139.     0xd3db, 0xde3d, 0x3800,
  140.     0x0018, 0x00fe, 0x1630, 0xd800, 0x600c, 0x3818, 0x007c, 0x0030,
  141.     0xe618, 0x6006, 0xc60c, 0xc630, 0xc618, 0x0000, 0x3000, 0x1830,
  142.     0xcec6, 0xc6c0, 0xccc0, 0xc0c6, 0xfe18, 0x06cc, 0xc0d6, 0xdec6,
  143.     0xf8ca, 0xf806, 0x30c6, 0x6cee, 0x6c18, 0x3060, 0x0c0c, 0x0000,
  144.     0x0076, 0xc6c0, 0xc6de, 0x60c6, 0xc630, 0x18cc, 0x18d6, 0xc6c6,
  145.     0xc6c6, 0x607c, 0x30c6, 0x6cd6, 0x38c6, 0x3830, 0x180c, 0x0000,
  146.     0xdb37, 0x33fb, 0x00ff,
  147.     0x0000, 0x006c, 0x1666, 0xcc00, 0x3018, 0xd618, 0x3000, 0x3060,
  148.     0xc618, 0xc00c, 0xfe18, 0xc660, 0xc630, 0x3030, 0x187e, 0x3000,
  149.     0xc0fe, 0xc6c0, 0xd8c0, 0xc0c6, 0xc618, 0x06c6, 0xc0c6, 0xcec6,
  150.     0xc0cc, 0xcc0c, 0x30c6, 0x38c6, 0xc618, 0x6060, 0x060c, 0x0000,
  151.     0x00c6, 0xc6c0, 0xc6c0, 0x6076, 0xc630, 0x18c6, 0x18c6, 0xc6c6,
  152.     0xc6c6, 0x6006, 0x30c6, 0x38fe, 0x6c76, 0x6030, 0x180c, 0x0000,
  153.     0x666d, 0x6637, 0x7c00,
  154.     0x0018, 0x0000, 0x7cc6, 0x7600, 0x1c70, 0x0000, 0x3000, 0x30c0,
  155.     0x7c18, 0xfe18, 0x0630, 0x7cc0, 0x7c60, 0x3030, 0x0c00, 0x6030,
  156.     0x7cc6, 0xfc7e, 0xf0fe, 0xc07e, 0xc63c, 0xfcc6, 0xfec6, 0xc67c,
  157.     0xc076, 0xc618, 0x307c, 0x1082, 0xc618, 0xfe7c, 0x037c, 0x00fe,
  158.     0x007e, 0xfc7e, 0x7e7c, 0x6006, 0xc630, 0x18c6, 0x18c6, 0xc67c,
  159.     0xdc76, 0x600c, 0x1c7e, 0x10c6, 0xc60c, 0xfe1c, 0x1878, 0x0000,
  160.     0x3ccf, 0xcc6f, 0x0000,
  161.     0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0x6000, 0x0000,
  162.     0x0000, 0x0030, 0x0060, 0x0080, 0x00c0, 0x0060, 0x0000, 0x0000,
  163.     0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  164.     0x0000, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  165.     0x0000, 0x0000, 0x0000, 0x007c, 0x0000, 0xf000, 0x0000, 0x0000,
  166.     0xc006, 0x0018, 0x0000, 0x0000, 0x0078, 0x0000, 0x1800, 0x0000,
  167.     0x0001, 0x0fc3, 0x0000,
  168. };
  169.  
  170. static ULONG    CharLoc[] =
  171. {
  172.     0x00000008, 0x00080008, 0x00100008, 0x00180008,
  173.     0x00200008, 0x00280008, 0x00300008, 0x00380008,
  174.     0x00400008, 0x00480008, 0x00500008, 0x00580008,
  175.     0x00600008, 0x00680008, 0x00700008, 0x00780008,
  176.     0x00800008, 0x00880008, 0x00900008, 0x00980008,
  177.     0x00a00008, 0x00a80008, 0x00b00008, 0x00b80008,
  178.     0x00c00008, 0x00c80008, 0x00d00008, 0x00d80008,
  179.     0x00e00008, 0x00e80008, 0x00f00008, 0x00f80008,
  180.     0x01000008, 0x01080008, 0x01100008, 0x01180008,
  181.     0x01200008, 0x01280008, 0x01300008, 0x01380008,
  182.     0x01400008, 0x01480008, 0x01500008, 0x01580008,
  183.     0x01600008, 0x01680008, 0x01700008, 0x01780008,
  184.     0x01800008, 0x01880008, 0x01900008, 0x01980008,
  185.     0x01a00008, 0x01a80008, 0x01b00008, 0x01b80008,
  186.     0x01c00008, 0x01c80008, 0x01d00008, 0x01d80008,
  187.     0x01e00008, 0x01e80008, 0x01f00008, 0x01f80008,
  188.     0x02000008, 0x02080008, 0x02100008, 0x02180008,
  189.     0x02200008, 0x02280008, 0x02300008, 0x02380008,
  190.     0x02400008, 0x02480008, 0x02500008, 0x02580008,
  191.     0x02600008, 0x02680008, 0x02700008, 0x02780008,
  192.     0x02800008, 0x02880008, 0x02900008, 0x02980008,
  193.     0x02a00008, 0x02a80008, 0x02b00008, 0x02b80008,
  194.     0x02c00008, 0x02c80008, 0x02d00008, 0x02d80008,
  195.     0x02e00008, 0x02e80008, 0x02f00008, 0x02f80008,
  196.     0x03000008, 0x03080008, 0x03100008, 0x03180008,
  197.     0x03200008, 0x03280008, 0x00000008, 0x00000008,
  198.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  199.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  200.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  201.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  202.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  203.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  204.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  205.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  206.     0x00000008, 0x03000008, 0x00000008, 0x00000008,
  207.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  208.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  209.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  210.     0x00000008, 0x00000008, 0x00000008, 0x00000008,
  211.     0x03080008, 0x03100008, 0x03180008,
  212. };
  213.  
  214. struct TextFont SeePixFont =
  215. {
  216.     {                /* Message     */
  217.     {            /* Node     */
  218.         NULL,        /* ln_Succ     */
  219.         NULL,        /* ln_Pred     */
  220.         NT_FONT,        /* ln_Type     */
  221.         0,            /* ln_Pri     */
  222.         fontname,        /* ln_Name     */
  223.     },
  224.     NULL,            /* mn_ReplyPort     */
  225.     sizeof(SeePixFont) +
  226.     sizeof(fontname) +
  227.     sizeof(CharData) +
  228.     sizeof(CharLoc) +
  229.     0,            /* mn_Length     */
  230.     },
  231.     8,                /* tf_YSize     */
  232.     0,                /* tf_Style     */
  233.     66,                /* tf_Flags     */
  234.     8,                /* tf_XSize     */
  235.     6,                /* tf_Baseline     */
  236.     1,                /* tf_BoldSmear     */
  237.     0,                /* tf_Accessors     */
  238.     32,                /* tf_LoChar     */
  239.     190,            /* tf_HiChar     */
  240.     (APTR) & CharData,        /* tf_CharData     */
  241.     102,            /* tf_Modulo     */
  242.     (APTR) & CharLoc,        /* tf_CharLoc     */
  243.     NULL,            /* tf_CharSpace     */
  244.     NULL,            /* tf_CharKern     */
  245. };
  246.